const path = require('path')
const fs = require('fs')
const os = require('os')
// 格式化日期
const moment = require('moment')

module.exports = (req, res, next) => {
  let filename = path.join(__dirname, '../logs/' + moment().format('YYYY-MM-DD') + '.log')
  let data = 'aaaaa == ' + req.session['username'] + os.EOL
  fs.appendFileSync(filename, data)
  next()
}